using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace WebShop.Contracts
{
    [Table("Users")]
    public class User
    {
        public User()
        {
            this.Orders = new HashSet<Order>();
            this.Roles = new HashSet<Role>();
        }

        [Key]
        [ScaffoldColumn(false)]
        public int UserId { get; set; }

        [Display(Name = "Login")]
        public string UserName { get; set; }

        [DataType(DataType.EmailAddress)]
        public string Email { get; set; }

        [ScaffoldColumn(false)]
        public string Password { get; set; }

        [ScaffoldColumn(false)]
        public string PasswordSalt { get; set; }

        [DataType(DataType.MultilineText)]
        public string Comments { get; set; }

        [DataType(DataType.Date)]
        [Display(Name = "Created Date")]
        public DateTime CreatedDate { get; set; }

        [ScaffoldColumn(false)]
        public DateTime? LastModifiedDate { get; set; }

        [DataType(DataType.Date)]
        [Display(Name = "Last Login Date")]
        [DisplayFormat(DataFormatString = "{0:g}")]
        public System.DateTime LastLoginDate { get; set; }

        [ScaffoldColumn(false)]
        public string LastLoginIp { get; set; }

        [Display(Name = "Active")]
        public bool IsActivated { get; set; }

        [Display(Name = "Locked")]
        public bool IsLockedOut { get; set; }

        [ScaffoldColumn(false)]
        public DateTime LastLockedOutDate { get; set; }

        [ScaffoldColumn(false)]
        public string LastLockedOutReason { get; set; }

        [ScaffoldColumn(false)]
        public string NewPasswordKey { get; set; }

        [ScaffoldColumn(false)]
        public DateTime? NewPasswordRequested { get; set; }

        [ScaffoldColumn(false)]
        public string NewEmail { get; set; }

        [ScaffoldColumn(false)]
        public string NewEmailKey { get; set; }

        [ScaffoldColumn(false)]
        public DateTime? NewEmailRequested { get; set; }

        [Display(Name = "Name")]
        public string ContactName { get; set; }

        public string Address { get; set; }

        public string City { get; set; }

        public string Region { get; set; }

        [Display(Name = "Postal Code")]
        public string PostalCode { get; set; }

        public string Country { get; set; }

        public string Phone { get; set; }

        public string Fax { get; set; }

        public virtual ICollection<Order> Orders { get; set; }
        public virtual ICollection<Role> Roles { get; set; }
    }
}
